<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('新增福利地区配置')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>

</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-welfareRegionConfig-add" AUTOCOMPLETE="OFF">
        <div class="form-group">
            <label class="col-sm-3 control-label ">代码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="code" id="code" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">名称：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="title" id="title" required>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">薪资城市：</label>
            <div class="col-sm-8">
                <select id="payCity" name="payCity" class="form-control">
                    <option value="0"></option>
                    <option th:each="ecdCitie:${ecdCities}" th:value="${ecdCitie.id}"
                            th:text="${ecdCitie.title}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label ">备注：</label>
            <div class="col-sm-8">
                <textarea id="remark" name="remark" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: datetimepicker-js" />

<script type="text/javascript">
    var prefix = ctx + "welfare/region/welfareRegionConfig";
    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function add() {
        if ($.validate.form()) {
            var data = $("#form-welfareRegionConfig-add").serializeArray();
            var code = $("input[name='code']").val();
            var title = $("input[name='title']").val();
            var remark =  $("#remark").val();
            var payCity = $("#payCity").val();
            data.push({"id": "code", "value": code});
            data.push({"id": "title", "value": title});
            data.push({"id": "remark", "value": remark});
            data.push({"id": "payCity", "value": payCity});
            $.operate.save(prefix + "/add", data);
        }
    }
</script>
</body>
</html>